﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CitiesCountries.aspx.cs" Inherits="Admin_CitiesCountries"
    Title="CitiesCountries" MasterPageFile="~/Shared/DefaultMaster.master" %>

<%@ Register Assembly="Microsoft.Practices.Web.UI.WebControls" Namespace="Microsoft.Practices.Web.UI.WebControls"
    TagPrefix="pp" %>
<asp:Content ID="content" ContentPlaceHolderID="DefaultContent" Runat="Server">
    <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManagerCountriesCities" runat="server">
    </ajaxToolkit:ToolkitScriptManager>
		<br />
            <ajaxToolkit:TabContainer ID="TabContainerCountriesCities" runat="server" ActiveTabIndex="1">
                <ajaxToolkit:TabPanel ID="TabPanelCountries" runat="server" HeaderText="Paises">
                    <ContentTemplate>
                        <h3>Administraci&oacute;n de paises</h3>
    <p>   <pp:ObjectContainerDataSource ID="CountryContainerDataSource" runat="server" DataObjectTypeName="Metro.Admin.BusinessEntities.Country" OnDeleted="CountryContainerDataSource_Deleted" OnInserted="CountryContainerDataSource_Inserted" OnUpdated="CountryContainerDataSource_Updated" />
        </p>
        <p><b>Agregar nuevo Pa&iacute;s</b></p>    
    <asp:DetailsView ID="DetailsViewCountry" runat="server" AutoGenerateRows="False"
        DataSourceID="CountryContainerDataSource" GridLines="None" Height="50px" Width="125px" DefaultMode="Insert">
        <Fields>
            <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" />
            <asp:BoundField DataField="Name" HeaderText="Nombre" SortExpression="Name" />
            <asp:CommandField ButtonType="Button" InsertText="Agregar" ShowCancelButton="False" ShowInsertButton="True" />
        </Fields>
    </asp:DetailsView>
    <br />
    <p><b>Lista de Paises</b></p>
            <asp:GridView ID="CountriesGridView" runat="server" AutoGenerateColumns="False" DataSourceID="CountryContainerDataSource" BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" GridLines="None" CellSpacing="1" DataKeyNames="Id" >
                <Columns> 
                    <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ButtonType="Image" CancelImageUrl="~/images/cross.png" DeleteImageUrl="~/images/delete.png" EditImageUrl="~/images/pencil.png" UpdateImageUrl="~/images/tick.png"/>
                    <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" />
                    <asp:BoundField DataField="Name" HeaderText="Nombre" SortExpression="Name" />
                </Columns>
                <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
                <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
                <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
                <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
            </asp:GridView>
                    </ContentTemplate>
                </ajaxToolkit:TabPanel>
                <ajaxToolkit:TabPanel ID="TabPanelCities" runat="server" HeaderText="Ciudades">
                    <ContentTemplate>
                         <h3>Administraci&oacute;n de ciudades</h3>
                        <pp:ObjectContainerDataSource ID="CountriesContainerDataSource" runat="server" DataObjectTypeName="Metro.Admin.BusinessEntities.Country" />
                        <pp:ObjectContainerDataSource ID="CityContainerDataSource" runat="server" DataObjectTypeName="Metro.Admin.BusinessEntities.City" OnDeleted="CityContainerDataSource_Deleted" OnInserted="CityContainerDataSource_Inserted" OnUpdated="CityContainerDataSource_Updated" />
                        <br />
                        <p><b>Agregar nueva ciudad</b></p>   
                        <asp:DetailsView ID="CityDetailsView" runat="server" Height="50px" Width="125px" AutoGenerateRows="False" DataSourceID="CityContainerDataSource" DefaultMode="Insert">
                            <Fields>
                                <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" />
                                <asp:BoundField DataField="Name" HeaderText="Nombre" SortExpression="Name" />
                                <asp:TemplateField HeaderText="Pa&iacute;s">
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddlCountry" runat="server" DataSourceId="CountriesContainerDataSource" DataTextField="Name" DataValueField="Id" >
                                        </asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:CommandField ButtonType="Button" InsertText="Agregar" ShowCancelButton="False" ShowInsertButton="True" />
                            </Fields>
                        </asp:DetailsView>
                        <br />
                        <p><b>Lista de ciudades</b></p>   
                        <p>
                       <asp:GridView ID="GridViewCities" runat="server" AutoGenerateColumns="False" BackColor="White"
                            BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1"
                            DataSourceID="CityContainerDataSource" GridLines="None" DataKeyNames="Id" >
                            <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
                            <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
                            <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
                            <Columns>
                                <asp:CommandField ShowEditButton="True" ShowDeleteButton="True" ButtonType="Image" CancelImageUrl="~/images/cross.png" DeleteImageUrl="~/images/delete.png" EditImageUrl="~/images/pencil.png" UpdateImageUrl="~/images/tick.png"/>
                                <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" />
                                <asp:BoundField DataField="Name" HeaderText="Nombre" SortExpression="Name" />
                            </Columns>
                            <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
                            <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
                        </asp:GridView>
                           </p>
                                         </ContentTemplate>
                </ajaxToolkit:TabPanel>
            </ajaxToolkit:TabContainer>
</asp:Content>
